All Questions
Tagged with postgresqlsql
92 questions
5votes
2answers
680views
A schema for awallet system that allows transfers between users
I am currently working on a wallet system that allows transfers of money between users. I tried creating this as a Stack Overflow question, but it was rejected. I'm not sure if this is the right ...
2votes
1answer
62views
Postgresql generated column from Finnish personal identity code
The Finnish personal identity code is defined as: Day, month, and year of birth, in ddmmyy form (six digits, zero padded if necessary) A separator For those born &...
3votes
1answer
60views
PostgreSQL Search Feature
The Problem I am developing a search feature in PostgreSQL that involves a collection of JSONB documents stored in a table, which have been standardised. The goal is to enable clients to perform ...
0votes
1answer
45views
Find and conditionally sort all venues matching a filter provided by an API client in PostgreSQL
I have an API where users can retrieve a list of "venues". Every venue is a profile, but not every profile is a venue Venues can be "parents" of other venues (think hotel - floor -...
1vote
2answers
34views
Creating single table vs creating multiple table
I have lots of services which I am integrating. (also I am new to sql) For each service integration I get different response, For example, for zoom, I would just need to store the access_Token, for ...
2votes
1answer
62views
Update table with data from another table under certain criteria
I need to update a lot of data from one table based on criteria from another table. My tables and records in those tables look like this: This is Users table where i can have many records for single ...
2votes
1answer
149views
Extracting authors and books from XML and inserting them into PostgreSQL
There is a tree of start folder, it's subfolders, their subfolders, etc. In each folder, subfolder, etc. there are the same structured XML files stored. books.xml ...
1vote
1answer
44views
PostgreSQL query which return metrics joining different tables
I have a query that can be seen on this fiddle and I'm relatively new to PSQL, having a few months of experience. DB Fiddle As mentioned in the comment I should put the query here and the code is ...
2votes
0answers
27views
Plpgsql function that redacts substrings wrapped with double pipes `||`
I'm using Postgres 14 and I've written a function (for use with Hasura GraphQL Computed Fields) that transforms a TEXT field, replacing all instances of spoiler-annotated text (e.g. ...
0votes
1answer
33views
Comparing two columns across tables for a remaining subset
How can I find the unique phone numbers (and collapse them into a single column) from table_1 (while keeping the IDs and date fields), and remove phone numbers that appear in table_2? table_1 id ...
2votes
1answer
48views
Find coherent datetime ranges in postgresql
My Data consists of rows containing a Length/Duration in Minutes, a Begin & EndTime. The precision is 1min (or larger). the table looks something like that: ...
5votes
1answer
134views
PostgreSQL: Grouping and Aggregating on multiple columns
Problem Statement: I am working on this simple dataset from Kaggle. I have provided a snippet of data with only required columns in below table. Dataset is quite simple, it has all IPL (cricket) ...
1vote
1answer
69views
Simple website sql database
I'm getting into backend with postgresql and I would like to know how much of my example would fit for a real website database, just for storing and then displaying it on website. ...
1vote
2answers
2kviews
A discord.py bot that logs every messages sent in a discord server
Hello Code Review community ! I'm making a bot with discord.py that listens to every message sent in a server and stores it in a database that could be retrieved by admin/mod later. Here's the ...
2votes
1answer
151views
Getting new vs. returning customers in Postgres
I have this work task, to write a SQL query that would show how many of the active customers are new (= do not have prior transactions) as opposed to returning per a given period. There is nothing ...